package com.adjy.pathbuilders.objects;

import android.util.Log;

import com.adjy.pathbuilders.world.MainChar;

/**
 * Enuum to define the Types of GameEntities
 */
public enum GameEntityType {
	MAINCHAR("MainChar"), WALL("Wall"), BOX("Box"), CLOUD("Cloud"), APPLE("Apple"), FLOOR("Floor"),
	ADRENALIN("Adrenalin"), DRINK("Drink"), LIFE("Life"), FIRE("Fire"), COIN("Coin"), DOOR("Door"), TIMECLOCK("TimeClock"),
	SPRING("Spring"),ARROW("Arrow"),BUBBLES("Bubbles");
	
	private String id;
	
	private GameEntityType(String id) {
		this.id = id;
	}
	
	public String getID() {
		return this.id;
	}
	
	public static GameEntityType get(String name) {
		
		GameEntityType[] types = GameEntityType.values();
		
		for (int i = 0 ; i < types.length ; i++) {
			if (types[i].getID().equals(name)) {
				return types[i];
			}
		}
		return null;
	}
	
	public static float[] getSizeFor(GameEntityType type) {
		switch (type) {
		case MAINCHAR:
			return MainChar.SIZE;
		case WALL:
			return Wall.SIZE;
		case BOX:
			return Box.SIZE;
		case CLOUD:
			return Cloud.SIZE;
		case APPLE:
			return Apple.SIZE;
		case FLOOR:
			return Floor.SIZE;
		case ADRENALIN:
			return Adrenalin.SIZE;
		case DRINK:
			return Drink.SIZE;
		case LIFE:
			return Life.SIZE;
		case FIRE:
			return Fire.SIZE;
		case COIN:
			return Coin.SIZE;
		case DOOR:
			return Door.SIZE;
		case TIMECLOCK:
			return TimeClock.SIZE;
		case SPRING:
			return Spring.SIZE;
		case ARROW:
			return Arrow.SIZE;
		case BUBBLES:
			return DrinkEffect.SIZE;
		default:
			Log.e("GetSize", "Size for " + type.getID() +
					" is not specified in GameEntityType... returning 1, 1 size");
			return new float[] {1, 1};
		}
	}
	
	public static String getDefaultAnimationName(GameEntityType type) {
		switch (type) {
		case MAINCHAR:
			return "mainchar_idle_right";
		case WALL:
			return "wall";
		case BOX:
			return "box";
		case CLOUD:
			return "cloud";
		case APPLE:
			return "apple";
		case FLOOR:
			return "floor";
		case ADRENALIN:
			return "adrenalin";
		case DRINK:
			return "drink";
		case LIFE:
			return "life";
		case FIRE:
			return "fire";
		case COIN:
			return "coin";
		case TIMECLOCK:
			return "timeclock";
		case DOOR:
			return "door_closed";
		case SPRING:
			return "spring_idle";
		case ARROW:
			return "arrow_show";
		case BUBBLES:
			return "bubbles_drink";
		default:
			Log.e("GetDefaultAnimationName", "AnimationName for " + type.getID() +
					" is not specified in GameEntityType... returning null");
			return null;
		}
	}
	
	
	
}
